package com.resource.controller;

import com.resource.request.OfficeProjectTaskRequest;
import com.resource.service.OfficeProjectTaskService;
import com.resource.utils.ResultBody;
import com.resource.utils.ServiceResultHandler;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.function.Consumer;

/**
 * 项目任务管理模块
 *
 * @author jianghao.zhang
 **/
@RestController
@RequestMapping(value = "/api/project/task")
public class OfficeProjectTaskController {
    @Resource
    private OfficeProjectTaskService projectTaskService;

    /**
     * 创建项目任务
     */
    @PostMapping("/add")
    public ResultBody addProjectTask(@RequestBody OfficeProjectTaskRequest request) {
        return ServiceResultHandler
                .process((Consumer<Object>) (o) -> projectTaskService.addProjectTask((OfficeProjectTaskRequest) o), request);
    }

}
